import redis
from config import redis

def save_code(email:str,code:str) ->None:
    client = redis.Redis(host=redis.get('host'),port=redis.get('port'),db=redis.get('db'))
    client.set(email,code)

def get_code(email:str) ->str:
    client = redis.Redis(host=redis.get('host'),port=redis.get('port'),db=redis.get('db'))
    code = client.get(email)
    if code:
        return code.decode()
    else:
        return ''